package com.bwhx.eruler.service.casdilly.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bwhx.eruler.bean.Page;
import com.bwhx.eruler.bean.casdilly.BodyItem;
import com.bwhx.eruler.dao.casdilly.BodyItemDAO;
import com.bwhx.eruler.dao.hodo.ClothesSizeDAO;
import com.bwhx.eruler.service.casdilly.BodyItemService;

@Service
public class BodyItemServiceImpl implements BodyItemService {

	@Autowired
	BodyItemDAO bodyItemDAO;
	
	@Autowired
	ClothesSizeDAO clothesSizeDAO;
	
	
	@Transactional
	@Override
	public void insert(BodyItem bodyItem) {
		BodyItem ResultBeanBodyItem = bodyItemDAO.insertAndReturnID(bodyItem);
		clothesSizeDAO.addComponent(ResultBeanBodyItem);
		
 	}

	@Override
	public List<BodyItem> list(Page p) {
		return bodyItemDAO.list(p);
	}

	@Override
	public Integer count(BodyItem bodyItem) {
		return  bodyItemDAO.count(bodyItem);
	}

	@Override
	public void del(BodyItem bodyItem) {
		bodyItemDAO.del(bodyItem);
		
	}

	@Override
	public BodyItem findByName(String itemName) {
		return bodyItemDAO.findByName(itemName);
	}

	@Override
	public List<BodyItem> listByIds(String[] idsArr) {
		return bodyItemDAO.listByIds(idsArr);
	}

	@Override
	public List<BodyItem> notInIds(String[] idsArr) {
		return bodyItemDAO.notInIds(idsArr);
	}
}
